package atguigu.ScadaEquipCheckNodeInfoUtils;

import com.alibaba.fastjson.JSONObject;

import cn.hutool.core.io.FileUtil;

public class Main4 {

	public static void main(String[] args) {
		String aCode = "A2211080005160014,TA2211080005160014010102,压缩机耐久试验台1350B;"+
				"A2211080005160014,TA2211080005160014010103,压缩机耐久试验台1350B;"+
				"A2211080005160014,TA2211080005160014010109,压缩机耐久试验台1350B;"+
				"A2211080005160013,TA2211080005160013010102,压缩机耐久试验台1307A(防爆);"+
				"A2211080005160013,TA2211080005160013010103,压缩机耐久试验台1307A(防爆);"+
				"A2211080005160013,TA2211080005160013010109,压缩机耐久试验台1307A(防爆);"+
				"A2211080005160035,TA2211080005160035010108,压缩机耐久试验台Q;"
				;
		String[] split = aCode.split(";");
		FileUtil.appendString("[", "D://ScadaPriorityEquip.txt", "UTF-8");
		for (int i = 0; i < split.length; i++) {
			String[] split2 = split[i].split(",");
			ScadaPriorityEquip equip = new ScadaPriorityEquip();
			equip.setaCode(split2[0]);
			equip.setEquipmentNo(split2[1]);
			equip.setEquipmentName(split2[2]);
			FileUtil.appendString(JSONObject.toJSONString(equip) + ",", "D://ScadaPriorityEquip.txt", "UTF-8");
		}
		FileUtil.appendString("]", "D://ScadaPriorityEquip.txt", "UTF-8");
		System.out.println("结束");
	}
}
